package com.sjm.suchbear.easymap;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TaskDetilActivity extends AppCompatActivity {

    @BindView(R.id.ll_header_back)
    LinearLayout llHeaderBack;
    @BindView(R.id.tv_list_title)
    TextView tvListTitle;
    @BindView(R.id.iv_header_function_ico)
    ImageView ivHeaderFunctionIco;
    @BindView(R.id.ll_header_function)
    LinearLayout llHeaderFunction;
    @BindView(R.id.ll_List_Main)
    RelativeLayout llListMain;
    @BindView(R.id.tv_taskTitle)
    TextView tvTaskTitle;
    @BindView(R.id.tv_taskMain)
    TextView tvTaskMain;
    @BindView(R.id.tv_startTask)
    TextView tvStartTask;

    private String taskID;
    private String taskTitle;
    private String taskMain;
    private int status;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_task_detil);
        ButterKnife.bind(this);
        tvListTitle.setText("任务详情");
        intent = getIntent();
        taskID = intent.getStringExtra("taskID");
        taskTitle = intent.getStringExtra("taskTitle");
        taskMain = intent.getStringExtra("taskMain");
        status = intent.getIntExtra("status", 0);
        tvTaskTitle.setText("任务主题:".concat(taskTitle));
        tvTaskMain.setText("任务描述：".concat(taskMain));
        if (status == 0) {
            tvStartTask.setVisibility(View.VISIBLE);
        } else {
            tvStartTask.setVisibility(View.GONE);
        }
    }

    @OnClick({R.id.ll_header_back, R.id.tv_startTask})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_header_back:
                finish();
                break;
            case R.id.tv_startTask:
                intent = new Intent(TaskDetilActivity.this, MainActivity.class);
                intent.putExtra("model", 4);
                intent.putExtra("taskID", taskID);
                startActivity(intent);
                break;
        }
    }
}
